Colin Walters [Fri, 8 Sep 2023 11:50:37 +0000 (07:50 -0400)]
rust: Switch to using `include`
This way we don't randomly pick up bits from the C library
unintentionally as things change on that side.
I think the support for `!` in `include` may be relatively new
and that's why the original author here chose to do things
via `exclude`. But using `include` with a few specific exclusions
is just way better.
Jonathan Lebon [Mon, 11 Sep 2023 02:14:39 +0000 (22:14 -0400)]
lib/pull: Drop static delta superblocks references
We don't need them long-lived anymore. They were just used for reporting
at this point, but we can use the new `static_delta_targets` hash table
size for that now.
Jonathan Lebon [Fri, 8 Sep 2023 20:54:29 +0000 (16:54 -0400)]
lib/pull: Don't scan commit objects we fetch via deltas
When we're fetching a commit via static delta, we already take care of
fetching the full commit, so there's no need to also scan it using the
regular object workflow.
Jonathan Lebon [Fri, 8 Sep 2023 20:50:47 +0000 (16:50 -0400)]
lib/pull: Fix miscounting of missing metadata
If e.g. detached metadata or a parent commit is missing, we
don't consider it an error but we erroneously still increment the
`n_fetched_metadata` counter, causing it to be higher than it should.
This will implicitly be tested by a test added in the next patch.
Colin Walters [Thu, 31 Aug 2023 18:40:01 +0000 (14:40 -0400)]
rust: Port to glib 0.18
- Also rolls up a few other changes in the C API
- Drop `&mut` from `OstreeKernelArgs`; it now confuses type inference.
More generally while using `&mut` here was well intentioned, it
goes against the glib standard of mapping everything to `&` and
accepting interior mutability.
Colin Walters [Wed, 30 Aug 2023 13:19:42 +0000 (09:19 -0400)]
keyfile-utils: Quiet a clang-analyzer warning
It complains that we could leak memory if the return value
pointer isn't set. That's actually a nonsensical case, there's
no reason to call this and ignore the return value.
So change things to require it be set, and also change the
`g_return_val_if_fail` to be hard assertions per our new policy.
Colin Walters [Tue, 29 Aug 2023 14:15:52 +0000 (10:15 -0400)]
mutable-tree: Change some `g_return_if_fail` to `g_assert()`
We did this in some prior patches because it's better for
static analyzers; code is either reachable or not, and we don't
want the default desktop-style behavior of "try to stumble on
without crashing". It's just likely to lead to a crash somewhere
else.
Colin Walters [Tue, 29 Aug 2023 14:09:25 +0000 (10:09 -0400)]
mutable-tree: Quiet clang-analyzer warning
The warning here was about a use-after-free which is serious, but
I don't think it was reachable in practice, because we'd only
enter the second conditional if `contents_checksum != self->contents_checksum`,
yet we made them the same thing here.
Nevertheless, refactor the code to do a direct return in this
case because that's basically what happened before, and doing
so is a lot clearer.
Colin Walters [Mon, 21 Aug 2023 21:19:35 +0000 (17:19 -0400)]
composefs: Hard error except on ENOENT even in "optional" case
Since we enabled composefs at build time, the default (non-composefs)
case now always prints
`composefs: Optional support failed: No such file or directory`
But that's normal and expected.
Rework things here so that in the very special case where
we are in "maybe/optional" mode and we get ENOENT, then we
output a much more normal-looking message that doesn't include
the string "failed".
Now on the flip side - if I have explicitly enabled signature
checking, I think we *do* want to make that fatal even if
composefs is in "maybe" mode.
(This part is more debatable; perhaps we should just disallow
the case of "maybe" + signatures at all; but I think this is
an improvement in that direction)
Colin Walters [Mon, 21 Aug 2023 21:12:08 +0000 (17:12 -0400)]
prepare-root: Fold together composefs signature cases
Now that we don't support digest-but-not-signature verification
for composefs, the logic here was unnecessarily complicated.
With a prior prep patch that moved the composefs option
initialization up, we can just have everything related to signature
verification in a single conditonal.
Colin Walters [Mon, 21 Aug 2023 18:05:14 +0000 (14:05 -0400)]
prepare-root: Drop redundant print about signature/digest
We print if we're doing a signature+digest verification; its absence is
sufficient in the other case. The goal here is to avoid polluting
the logs when signatures are not enabled.
Colin Walters [Thu, 24 Aug 2023 23:48:22 +0000 (19:48 -0400)]
build-sys: Really fix composefs check
The ordering of the includes apparently matters...and I didn't
actually check that the previous change enables composefs on c9s.
But I did now. For reals.
While we have the patient open, I switched to `AC_LANG_PROGRAM`
because I originally thought the bug had something to do with that.
As far as I understand, more cleanly separating the includes
from the injected body text is a useful thing in `AC_LANG_PROGRAM`.
Colin Walters [Wed, 23 Aug 2023 20:06:23 +0000 (16:06 -0400)]
Move prepare-root karg helpers into otcore, add unit tests
Add long overdue unit testing coverage for this, which
at least slightly closes out the android boot CI gap.
Actually, this *copies* the karg parsing code into otcore because
it now uses glib, which we're not yet using in the static
prepare-root. It's pretty tempting to drop support for the
static prepare root entirely. But for now we'll live with some
code duplication.